<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
<head>
<title>IGNORED</title>
</head>
<body>
	<ui:composition template="/WEB-INF/layouts/base-layout.xhtml">
		<ui:define name="windowTitle">
			User Management
		</ui:define>

		<ui:define name="content">
 		
 			
 			<h:form prependId="false" id="form">
 			
 				<h:messages />
 				
				<h:panelGrid columns="3" style="width:400px;">
					<p:outputLabel value="User Name"/>
					<p:inputText id="userName" value="#{userBean.user.userName}" required="true" requiredMessage="#{msg['msg.userName.required']}">
						<f:validateLength minimum="8" maximum="15" />
					</p:inputText>
					<h:message for="userName" />  
					
					<p:outputLabel value="Password"/>
					<p:inputText id="password" value="#{userBean.user.password}"/>
					<p:tooltip for="password" showEvent="focus" hideEvent="blur" value="password should be atleast 6 chars long"/>
					
					<p:outputLabel value="Confirm Password"/>
					<p:inputText id="confirmPassword" value="#{userBean.confirmPassword}"/>
					<p:tooltip for="confirmPassword" showEvent="focus" hideEvent="blur" value="Confirm password that you provided above"/>
					
					<p:outputLabel value="Select Roles"/>
					<p:selectManyMenu id="roles" value="#{userBean.selectedRoles}" converter="roleConverter">
						<f:selectItems id="sel" value="#{userBean.roles}" var="r" itemLabel="#{r.roleName}" itemValue="#{r}"/>
					</p:selectManyMenu>
					<p:spacer width="10" height="10" />
										
					<p:spacer width="10" height="10" />
					<p:commandButton value="Save" update="form" actionListener="#{userBean.addUser}"/>
					<p:spacer width="10" height="10" />
				</h:panelGrid>
			</h:form>

		</ui:define>
	</ui:composition>
</body>
</html>